package sfeir.ergosum.myprofile;

import android.app.Activity;

public class MyProfileContactActivity extends Activity {
//
//	private LayoutInflater mInflater;
//	private static DetailsListAdapter adapter;
//
//	private static class ViewHolder {
//		CachedImageView picture;
//		TextView name;
//		TextView title;
//		TextView organisation;
//	}
//
//	@Override
//	protected void onCreate(Bundle savedInstanceState) {
//		super.onCreate(savedInstanceState);
//
//		setContentView(R.layout.contact_profile);
//
//		Contact contact = (Contact) getIntent().getSerializableExtra("contact");
//		Person p = contact.getPerson();
//
//		mInflater = LayoutInflater.from(MyProfileContactActivity.this);
//
//		LinearLayout basics = (LinearLayout) findViewById(R.id.basics);
//		ViewHolder holder;
//
//		basics = (LinearLayout) mInflater.inflate(R.layout.contact_mini_card, basics, true);
//
//		holder = new ViewHolder();
//		holder.picture = (CachedImageView) basics.findViewById(R.id.picture);
//		holder.name = (TextView) basics.findViewById(R.id.name);
//		holder.title = (TextView) basics.findViewById(R.id.title);
//		holder.organisation = (TextView) basics.findViewById(R.id.organisation);
//
//		basics.setTag(holder);
//
//		holder.name.setText(contact.getAlias());
//		if (p != null) {
//			holder.title.setText(p.getTitle());
//			holder.organisation.setText(p.getCompany());
//			holder.picture.generatedImageFromUrl(p.getPhoto().getImageUrl());
//
//		}
//
//		/*
//		 * For each list we check the type of the data and apply the appropriate
//		 * icon
//		 */
//		// LinearLayout details = (LinearLayout) findViewById(R.id.details);
//		ListView details = (ListView) findViewById(R.id.details_list);
//
//		adapter = new DetailsListAdapter(this, p);
//		details.setAdapter(adapter);
////
////		if (null != p.getBirthDay())
////			details.addView(getField(getResources().getDrawable(R.drawable.date), p.getBirthDay()));
////
////		for (Email e : p.getEmails()) {
////
////			View v;
////			final String email = e.getEmail();
////			final String[] mailto = { email };
////			OnClickListener emailListener = new OnClickListener() {
////				@Override
////				public void onClick(View v) {
////					Intent sendIntent = new Intent(Intent.ACTION_SENDTO);
////					sendIntent.setData(Uri.parse("mailto:" + mailto));
////					sendIntent.putExtra(Intent.EXTRA_EMAIL, mailto);
////					sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Sujet");
////					sendIntent.setType("text/plain");
////					startActivity(Intent.createChooser(sendIntent, "Choix du client mail"));
////				}
////			};
////
////			switch (e.getTypeEmail()) {
////			case Email.PERSONAL_EMAIL:
////				v = getField(getResources().getDrawable(R.drawable.email_perso), e.getEmail());
////				v.setClickable(true);
////				v.setOnClickListener(emailListener);
////				details.addView(v);
////				break;
////			case Email.PROFESSIONNAL_EMAIL:
////				v = getField(getResources().getDrawable(R.drawable.email_pro), e.getEmail());
////				v.setClickable(true);
////				v.setOnClickListener(emailListener);
////				details.addView(v);
////				break;
////			case Email.UNKNOWN:
////				v = getField(getResources().getDrawable(R.drawable.email), e.getEmail());
////				v.setClickable(true);
////				v.setOnClickListener(emailListener);
////				details.addView(v);
////				break;
////			default:
////				v = getField(getResources().getDrawable(R.drawable.email), e.getEmail());
////				v.setClickable(true);
////				v.setOnClickListener(emailListener);
////				details.addView(v);
////				break;
////			}
////		}
////
////		for (Tel t : p.getTels()) {
////			View v;
////			final String tel = t.getPhoneNumber().replace(" ", "");
////			OnClickListener telListener = new OnClickListener() {
////				@Override
////				public void onClick(View v) {
////					Intent i = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + tel));
////					startActivity(i);
////				}
////			};
////			switch (t.getType()) {
////			case Tel.MOBILE_LINE:
////
////				v = getField(getResources().getDrawable(R.drawable.phone_mobile), t.getPhoneNumber().toString());
////
////				v.setClickable(true);
////				v.setOnClickListener(telListener);
////				details.addView(v);
////				break;
////			case Tel.HOME_LANDLINE:
////				v = getField(getResources().getDrawable(R.drawable.phone_perso), t.getPhoneNumber().toString());
////
////				v.setClickable(true);
////				v.setOnClickListener(telListener);
////				details.addView(v);
////				break;
////			case Tel.PROFESSIONNAL_LINE:
////				v = getField(getResources().getDrawable(R.drawable.phone_pro), t.getPhoneNumber().toString());
////
////				v.setClickable(true);
////				v.setOnClickListener(telListener);
////				details.addView(v);
////				break;
////			default:
////				v = getField(getResources().getDrawable(R.drawable.phone_perso), t.getPhoneNumber().toString());
////
////				v.setClickable(true);
////				v.setOnClickListener(telListener);
////				details.addView(v);
////				break;
////			}
////		}
////
////		for (Address a : p.getAddresses()) {
////			final String adr = a.getFullValue().replace(" ", "+");
////			View v;
////			OnClickListener geoListener = new OnClickListener() {
////				@Override
////				public void onClick(View v) {
////					Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=" + adr));
////					startActivity(i);
////				}
////			};
////
////			switch (a.getType()) {
////			case Address.PERSONAL_ADDRESS:
////				v = getField(getResources().getDrawable(R.drawable.house), a.getFullValue());
////				v.setClickable(true);
////				v.setOnClickListener(geoListener);
////				details.addView(v);
////
////				break;
////			case Address.PROFESSIONNAL_ADDRESS:
////				v = getField(getResources().getDrawable(R.drawable.building), a.getFullValue());
////				v.setClickable(true);
////				v.setOnClickListener(geoListener);
////				details.addView(v);
////				break;
////			default:
////				break;
////			}
////		}
////
////		for (int i = 0; i < details.getChildCount(); i++) {
////			if (i % 2 == 0)
////				details.getChildAt(i).setBackgroundColor(Color.parseColor("#333333"));
////			else
////				details.getChildAt(i).setBackgroundColor(Color.parseColor("#181818"));
////		}
//
//	}
//
//	/**
//	 * Build a simple field of information with the given image and data
//	 * associated
//	 * 
//	 * @param image
//	 * @param content
//	 * @return
//	 */
//	private View getField(Drawable image, String content) {
//
//		LinearLayout field = new LinearLayout(MyProfileContactActivity.this);
//		field.setOrientation(LinearLayout.HORIZONTAL);
//		field.setGravity(Gravity.CENTER_VERTICAL);
//		field.setLayoutParams(new ViewGroup.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
//
//		ImageView img = new ImageView(MyProfileContactActivity.this);
//		img.setImageDrawable(image);
//
//		TextView space = new TextView(MyProfileContactActivity.this);
//		space.setText(" ");
//
//		TextView txt = new TextView(MyProfileContactActivity.this);
//		txt.setText(content);
//
//		field.addView(img);
//		field.addView(space);
//		field.addView(txt);
//
//		return field;
//	}
}
